<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/7/23
  Time: 10:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../css/reset.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/add.css"/>
</head>
<body>
<div id="app">
    <div class="header">
        <span>删除快递信息</span>
    </div>
    <div class="content">

        <table>
            <tr>
                <td class="text-right">运单号</td><td class="content_right"><input class="input inline-input" placeholder="请输入运单号码"> <span class="btn btn-info" onclick="form01Submit()">立即查找</span></td>
            </tr>
        </table>
    </div>


    <div class="header">
        <span>查找信息如下</span>
    </div>
    <div class="content" id="content">
        <table>
            <tr>
                <td class="text-right">快递单号</td><td class="content_right"><input class="input" placeholder="请输入姓名" disabled></td>
            </tr>
            <tr>
                <td class="text-right">快递公司</td><td class="content_right"><input class="input" placeholder="请输入姓名" disabled></td>
            </tr>
            <tr>
                <td class="text-right">收货人姓名</td><td class="content_right"><input class="input" placeholder="请输入姓名" disabled></td>
            </tr>
            <tr>
                <td class="text-right">手机号码</td><td class="content_right"><input class="input" placeholder="请输入姓名" disabled></td>
            </tr>
            <tr>
                <td class="text-right">快递状态</td><td class="content_right" disabled><span id="status" ></span>
            </tr>
            <tr>
                <td></td><td class="content_right"><span class="btn btn-info" onclick="confirm()">立即删除</span> <span class="btn" onclick="reset()">重置</span> </td>
            </tr>
        </table>
    </div>
</div>
<script src="../../js/jquery-1.11.1.js"></script>
<script src="../../layer/layer.js"></script>
<script src="../../assets/layui.all.js"></script>
<script>
    $(function () {
        reset();
    });
    function reset() {
        $("input").val("");
        $("#content").css("display","none");
    }
    function form01Submit () {
        var windowId = layer.load();
        var num = $("input:eq(0)").val();
        num=$.trim(num);
        $.post("/delivery/findDelivery.do",{
            number:num
        },function (data) {
            layer.close(windowId);
            if(data["msgCode"]==200){
                $("#content").css("display","");
                $("input:eq(1)").val(data["dataList"][0]["deliveryNum"]);
                $("input:eq(2)").val(data["dataList"][0]["deliveryCompany"]);
                $("input:eq(3)").val(data["dataList"][0]["deliveryAcceptor"]);
                $("input:eq(4)").val(data["dataList"][0]["acceptorPhone"]);
                layer.alert(data["dataList"][0]["deliveryState"]);
                if('存放中'==data["dataList"][0]["deliveryState"]){
                    $("#status").html("未签收");
                }else if('被取出'==data["dataList"][0]["deliveryState"]){
                    $("#status").html("已签收");
                }
                layer.alert("成功查寻到此快递！٩(๑>◡<๑)۶ ");
            }else if (data["msgCode"]==400){
                layer.alert("未查到此快递！(〒︿〒)");
            }
        },"json");
        return false;
    }
    function confirm() {
        layer.confirm("确定要删除嘛？",{tittle:"删除确认"},function () {
            var windowId = layer.load();
            var num = $("input:eq(1)").val();
            $.post("/delivery/delete.do",{
                deliveryNum:num,
            },function (data) {
                layer.close(windowId);
                if (data["msgCode"] == 200){
                    layer.alert("删除成功~   ヾ(^Д^*)/");
                }else {
                    layer.alert("删除失败了  (；´д｀)ゞ");
                }
            },"json");
            return false;
        })
    }


</script>
</body>
</html>
